package com.xzq.socket.aio.server;

import lombok.Data;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.AsynchronousChannelGroup;
import java.nio.channels.AsynchronousServerSocketChannel;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

/**
 * @Author xzq
 * @Description //TODO
 * @Date 2021/11/18 10:05
 * @Version 1.0.0
 **/
@Data
public class AioServer extends Thread{
    private AsynchronousServerSocketChannel serverSocketChannel;

    @Override
    public void run() {
        try {
            serverSocketChannel = AsynchronousServerSocketChannel.open(AsynchronousChannelGroup.withCachedThreadPool(Executors.newCachedThreadPool(), 10));
            serverSocketChannel.bind(new InetSocketAddress(9999));
            CountDownLatch latch = new CountDownLatch(1);

        } catch (IOException e) {
            e.printStackTrace();
        }
    }


}
